package hn.cch.template;

import hn.cch.entity.Master;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Repository;

import java.util.ArrayList;
import java.util.List;

@Component
public class MasterTemplate extends BaseTemplate<Master> {

    @Autowired
    private JdbcTemplate jdbcTemplate;

    public List<Master> getAll() {

        String sql = " select * from tbl_master ";
        List<Master> all = jdbcTemplate.query(sql, new BeanPropertyRowMapper<>(Master.class));
        return all;

    }
}
